package com.wiscamp.ninechapters.problems.infrastructure.po.problems;

import com.wiscamp.ninechapters.ddd.PersistenceObject;
import com.wiscamp.ninechapters.problems.enums.Actions;
import jakarta.persistence.*;
import lombok.Data;

import java.io.Serial;

/**
 * 问题选项
 */
@Entity
@Data
@Table(name = "question_options")
public class QuestionOptionPO implements PersistenceObject {

    @Serial
    private static final long serialVersionUID = 4091170862213915889L;

    /**
     * 选项编号
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(insertable = false, name = "option_id", nullable = false)
    private long optionId = 0;

    /**
     * 题编号
     */
    @Column(name = "problem_id", nullable = false)
    private long problemId = 0;

    /**
     * 问题编号
     */
    @Column(name = "question_id", nullable = false)
    private long questionId = 0;

    /**
     * 选项序号
     */
    @Column(name = "option_index", nullable = false)
    private int optionIndex = 0;

    /**
     * 问题超文本内容
     */
    @Column(name = "option_hypertext")
    private String optionHypertext = "";

    /**
     * 是否正确答案
     */
    @Column(name = "correct_answer", nullable = false)
    private boolean correctAnswer = false;

    /**
     * 锚点位置
     */
    @Column(name = "anchor_location", nullable = false)
    private int anchorLocation = 0;

    /**
     * 选项分组序号
     */
    @Column(name = "option_group_index", nullable = false)
    private int optionGroupIndex = 0;

    @Transient
    private Actions action = Actions.NONE;
}